package com.inno.subject.domain.listener;

import com.inno.subject.domain.utils.ApplicationContextUtil;
import com.inno.subject.domain.utils.ChatClientUtil;

import java.util.Objects;

/**
 * websocket关闭监听器
 *
 * @author sean
 */

public class SocketCloseListener {

    /**
     * 清除历史消息
     */
    public void invoke(Long currentUser){
        if (Objects.nonNull(currentUser)){
            ChatClientUtil chatClientUtil = ApplicationContextUtil.getBean(ChatClientUtil.class);
            chatClientUtil.clearHistoryMessage(currentUser);
        }
    }
}
